//
// AEntity.cpp for  in /home/lefebv_w//workspace/cpp/bomberman/googleCode/game
// 
// Made by damien lefebvre
// Login   <lefebv_w@epitech.net>
// 
// Started on  Wed May 29 14:31:40 2013 damien lefebvre
// Last update Wed May 29 14:59:47 2013 damien lefebvre
//

#include	"AEntity.hh"

AEntity::AEntity(Vector3f const & position, ALevel & level)
  : AObject(position), m_direction(RIGHT), m_level(level),
    m_radius(0.f), m_basicRotate(0.f, 0.f, 0.f), m_anim("none")
{}

void		AEntity::draw(void)
{
  glLoadIdentity();
  glTranslatef(m_position.x, m_position.y, m_position.z);
  glRotatef(m_basicRotate.z, 0.f, 0.f, 1.f);
  glRotatef(m_basicRotate.x, 1.f, 0.f, 0.f);
  glRotatef(m_basicRotate.y + (float)(m_direction), 0.f, 1.f, 0.f);
  m_model.draw();
  glLoadIdentity();
}

bool		AEntity::move(void)
{
  return (false);
}

void		AEntity::setMove(Direction dir)
{
  if (dir == m_direction)
    return ;
  m_direction = dir;
  if (m_model.animation_hasStarted(m_anim))
    m_model.stop_animation(m_anim);
  m_model.play(m_anim);
}
